package hookan.redo.common.item;

import hookan.redo.common.block.RedoBlocks;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;

public class RedoItems {
    public static Item itemBestSword = new ItemBestSword().setUnlocalizedName("bestSword");
    public static Item itemChromeIngot = new ItemChromeIngot().setUnlocalizedName("chromeIngot");

    public static void init()
    {
        ForgeRegistries.ITEMS.register(itemBestSword.setRegistryName("best_sword"));

        ForgeRegistries.ITEMS.register(itemChromeIngot.setRegistryName("chrome_ingot"));
        OreDictionary.registerOre("ingotChrome", itemChromeIngot);//注册矿物字典

    }

    @SideOnly(Side.CLIENT)
    public static void clientInit(){
        ModelLoader.setCustomModelResourceLocation(itemBestSword, 0,
                new ModelResourceLocation(itemBestSword.getRegistryName(), "inventory"));

        ModelLoader.setCustomModelResourceLocation(itemChromeIngot, 0,
                new ModelResourceLocation(itemChromeIngot.getRegistryName(), "inventory"));

    }

    public static void addSmelting() {
        GameRegistry.addSmelting(RedoBlocks.blockChromite, new ItemStack(itemChromeIngot), 0.5f);
    }
}
